package com.anolesoft.yr.mbus.prod.model.sql;

public class ProdServiceValueSQL {

    //根据主键查询产品服务项参数数据
    public static final String QUERY_PROD_SERVICE_VALUE_BY_UID = "select a.objuid,a.value,case when a.is_default=0 then '否' else '是' end is_default,case when a.is_holiday=0 then '否' else '是' end is_holiday,a.accept_time,a.reply_time,a.delivery_time,a.arrival_time,a.remark from prod_service_value a where a.del_flag=0 and a.prod_service_uid=#{objuid} order by a.value asc";

    //删除产品服务项参数信息
    public static final String DELETE_PROD_SERVICE_VALUE = "update prod_service_value a set a.del_flag=1 where a.prod_service_uid in(select a.objuid from prod_service a where a.prod_production_uid=#{objuid})";

    //删除产品服务项参数信息
    public static final String DELETE_PROD_SERVICE_VALUE2 = "update prod_service_value a set a.del_flag=1 where a.prod_service_uid=#{objuid}";

    //删除产品服务项参数信息
    public static final String DELETE_PROD_SERVICE_VALUE3 = "<script> update prod_service_value a set a.del_flag=1 where a.prod_production_uid=#{prodProductionUid} and a.prod_service_uid not in <foreach collection='prodServiceDeleteDTOList' open='(' item='prodService' separator=',' close=')'> #{prodService.objuid}</foreach> </script>";

    //新增服务项参数信息表
    public static final String SAVE_PROD_SERVICE_VALUE = "insert into prod_service_value(objuid,fac_code,prod_production_uid,prod_service_uid,prod_base_service_value_uid,value,is_default,is_holiday,accept_time,reply_time,delivery_time,arrival_time,remark,c_user_uid,c_time,del_flag) values(#{objuid},#{facCode},#{prodProductionUid},#{prodServiceUid},#{prodBaseServiceValueUid},#{value},#{isDefault},#{isHoliday},#{acceptTime},#{replyTime},#{deliveryTime},#{arrivalTime},#{remark},#{ccUserUid},#{ccTime},#{delFlag})";

    //根据主键查询产品服务项参数名称
    public static final String QUERY_PROD_SERVICE_VALUE_BY_UID2 = "select a.objuid,a.value from prod_service_value a where a.del_flag=0 and a.prod_service_uid=#{objuid} order by a.value asc";

    //根据主键查询产品服务项参数数据
    public static final String QUERY_PROD_SERVICE_VALUE_BY_UID3 = "select a.objuid,a.value,case when a.is_default=0 then '否' else '是' end is_default,case when a.is_holiday=0 then '否' else '是' end is_holiday,a.accept_time,a.reply_time,a.delivery_time,a.arrival_time,a.remark from prod_service_value a where a.del_flag=0 and a.objuid=#{objuid} order by a.value asc";

    //根据主键查询产品服务项参数数据
    public static final String QUERY_PROD_SERVICE_VALUE_BY_UID4 = "select a.* from prod_service_value a where a.del_flag=0 and a.objuid=#{objuid} order by a.value asc";

    //查询服务项参数
    public static final String QUERY_PROD_SERVICE_VALUE = "select a.objuid,a.value from prod_service_value a inner join prod_service b on b.objuid=a.prod_service_uid where a.del_flag=0 and b.service_name=#{serviceName} order by a.value asc";

    //查询询盘回访服务报价单中服务级别
    public static final String QUERY_PROD_SERVICE_VALUE3 = "select b.objuid,b.value from prod_service a left join prod_service_value b on b.prod_service_uid=a.objuid where a.service_name='服务级别' and a.del_flag=0 order by b.value asc";

}
